package main

import "fmt"

type Phone interface {
	call()
	sales() int
}

type NokiaPhone struct {
	price int
}

func (nokiaPhone NokiaPhone) call() {
	fmt.Println(`NokiaPhone is calling`)
}

func (nokiaPhone NokiaPhone) sales() int {
	return nokiaPhone.price
}

type Iphone struct {
	price int
}

func (iphone Iphone) call() {
	fmt.Println(`Iphone is calling`)
}

func (iphone Iphone) sales() int {
	return iphone.price
}

type Person struct {
	phones []Phone
	name   string
	age    int
}

func (person Person) total_cost() int {
	var sum = 0
	for _, phone := range person.phones {
		sum += phone.sales()
	}
	return sum
}

func main() {
	var bought_phones = [2]Phone{
		NokiaPhone{price: 1000},
		Iphone{price: 2000},
	}

	var person = Person{name: `muziyan`, age: 18, phones: bought_phones[:]}

	fmt.Println(person.total_cost())
	fmt.Println(person.name)
}
